import pygame

class Object:
    def __init__(self,pos,size=[32,32]):
        self.x,self.y = pos
        self.width = size[0]
        self.height = size[1]
        self.rect = pygame.Rect(self.x,self.y,self.width,self.height)
        self.angle = 0
        self.x_offset = -self.width/2
        self.y_offset = -self.height/2
    def move(self):
        self.xo = self.x + self.xc + self.x_offset
        self.yo = self.y + self.yc + self.y_offset
        
class Player(Object):
    def __init__(self,pos,img):
        Object.__init__(self,pos)
        self.baseImage = pygame.image.load(img).convert_alpha()
        self.image = self.baseImage.copy()
        self.rect = self.image.get_rect()
        
    def turn(self,amount):
        oldCenter = self.rect.center
        self.angle += amount
        self.image = pygame.transform.rotate(self.baseImage, self.angle)
        self.rect = self.image.get_rect()
        self.rect.center = oldCenter
        self.xc=self.rect[0]
        self.yc=self.rect[1]